 <#-- 
 
 crea una clase para c# para la tabla  ${table}...
 Author : Luis Molina...
 Project: ${project}
 Table :  ${table}
 -->
<#-- variables used internally by the generator... -->
<#assign nameFile="${table}">
<#assign extensionFile="php">
<#assign languageGenerated="php">
<#assign description="php class">
<#assign targetDirectory="classes">
<#assign appliesToAllTables="true">
<#-- END variables used internally by the generator... -->
<?php
require_once 'dbclass.php';


class ${table}
{
<#assign count=0>
<#list table.getFields() as field>
    var ${field};
    <#assign count = count+1>
</#list>

    /**
     * @property int idasociacion
     * @property string nombre
     */

    public function __construct()
    {
        //      $this->db = Mysql::singleton();
    }
    function ${table}( ${table.getListParameters()} )
    {
		<#assign count=0>
		<#list table.getFields() as field>
			$this->${field} = $${field};
			<#assign count = count+1>
		</#list>
        
    }

    function get${table}($id)
    {

        $db = new dbclass();
        try
        {
            $sql = "SELECT * FROM asociacion where idasociacion=".$id;
            $result = $db->query($sql);

            $this->idasociacion = mysql_result($result, 0, "idasociacion");
            $this->nombre = mysql_result($result, 0, "nombre");

        }
        catch(Exception $e)
        {


        }


        return $this;

    }

    function getlist()
    {

        $db = new dbclass();
        try
        {
            $sql = "SELECT nombre FROM asociacion";
            $result = $db->query($sql);
            $lista[$i] = new ${table}();


            // 			$lista= $db->fetch_rows($result);
            //return $result;
            return $lista;
            //			$this->idasociacion= mysql_result($result, 0, "idasociacion");
            //		$this->nombre= mysql_result($result, 0, "nombre");


        }
        catch(Exception $e)
        {


        }


        return $this;

    }
}

?>
